<?php

$elem = $this->element;

$elemName = $elem->getName();

$values = $elem->getValue();
if(!is_array($values)) {
    $values = null;
    $values[] = $elem->getValue();
}
$label = $elem->getLabel();

$errors = $elem->getMessages();
?>

 
<fieldset id="<?php echo $elemName; ?>-fieldset">
    <legend><?php echo $label; ?></legend>
    <?php foreach($elem->getMultiOptions() as $option=>$value){ ?>
    
    <div class="cat-checkbox-item">
        <label for="<?php echo $elemName; ?>-<?php echo $option; ?>">
            <input type="checkbox" name="<?php echo $elemName; ?>[]" id="<?php echo $elemName; ?>-<?php echo $option; ?>" value="<?php echo $option; ?>" <?php if($values && in_array($option, $values)){ echo ' checked="checked"'; }?> />
            <span class="checkbox-text" unselectable="on"><?php echo $value; ?></span>
            <div class="clearfix"></div>
        </label>
    </div>
    
    <?php } ?>
    <div class="clearfix"></div>
    <?php if($errors): ?>
        <ul>
        <?php foreach($errors as $error): ?>
            <li><?php echo $error; ?></li>
        <?php endforeach ?>
        </ul>
    <?php endif; ?>
</fieldset>